package org.lt.resume.controller.resume;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.lt.resume.domain.resume.Resume;
import org.lt.resume.service.resumeserviceInterface.ResumeServiceInterface;
import org.lt.resume.service.userserviceInterface.UserServiceInterface;

import com.opensymphony.xwork2.ActionSupport;

public class SaveResumeController extends ActionSupport {

	/** **/
	private static final long serialVersionUID = 6063873143634629044L;

	private ResumeServiceInterface resumeService;

	private String id;

	private String username;

	private String contactWay;

	private String major;

	private String degree;

	private Date graduateDate;

	private String graduateSchool;

	private String citylivein;

	private String oldPosition;

	private String oldCompany;

	private String fitposition;

	private String workExperience;

	private String comment;


	private Resume resumeVO = new Resume();

	@Override
	public String execute() throws Exception {

		resumeService.updateResume(resumeVO);

		return null;
	}

	public ResumeServiceInterface getResumeService() {
		return resumeService;
	}

	public void setResumeService(ResumeServiceInterface resumeService) {
		this.resumeService = resumeService;
	}

	public void setId(String id) {
		int resumeId;
		resumeId = Integer.valueOf(id);
		resumeVO.setId(resumeId);
	}

	public void setUsername(String username) {
		resumeVO.setUsername(username.trim());
	}

	public void setComment(String comment) {
		resumeVO.setComment(comment);
	}

	public void setContactWay(String contactWay) {
		resumeVO.setContactWay(contactWay);
	}

	public void setMajor(String major) {
		resumeVO.setMajor(major);
	}

	public void setDegree(String degree) {
		resumeVO.setDegree(degree);
	}

	public void setGraduateDate(String graduateDate) {
		SimpleDateFormat format2 = new SimpleDateFormat("dd/MM/yyyy");
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		try {
			System.out.println(graduateDate);
			this.graduateDate = format.parse(graduateDate);

			//format.format(format2.parse(graduateDate));
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		resumeVO.setGraduateDate(this.graduateDate);
	}

	public void setGraduateSchool(String graduateSchool) {
		resumeVO.setGraduateSchool(graduateSchool);
	}

	public void setCitylivein(String citylivein) {
		resumeVO.setCitylivein(citylivein);
	}

	public void setOldPosition(String oldPosition) {
		resumeVO.setOldPosition(oldPosition);
	}

	public void setOldCompany(String oldCompany) {
		resumeVO.setOldCompany(oldCompany);
	}

	public void setFitposition(String fitposition) {
		resumeVO.setFitposition(fitposition);
	}

	public void setWorkExperience(String workExperience) {
		resumeVO.setWorkExperience(workExperience);
	}	
}
